﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BW.MesProject.Public.Domain.RBAC
{
    /// <summary>
    /// 用户实体
    /// </summary>
    [SugarTable("Equipment.UserModel")]
    public class UserModel
    {
        /// <summary>
        /// 账号Id
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsNullable = false, ColumnDescription = "邮箱")]
        public string UserId { get; set; }
        /// <summary>
        /// 账号
        /// </summary>
        [SugarColumn(IsNullable =false, ColumnDescription = "账号")]
        public string UserName { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "密码")]
        public string Password { get; set; }

        /// <summary>
        /// 真实姓名
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "真实姓名")]
        public string RealName { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "邮箱")]
        public string UserEmail { get; set; }

        /// <summary>
        /// 手机
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "手机")]
        public string Phone { get; set; }

        /// <summary>
        /// 身份证号
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "身份证号")]
        public string IdCard { get; set; }


        /// <summary>
        /// 职位编码
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "职位编码")]
        public string? JobCode { get; set; }

        /// <summary>
        /// 部门编码
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "部门编码")]
        public string? DepCode { get; set; }

        /// <summary>
        ///是否启用
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "是否启用")] 
        public bool IsEnable { get; set; }

        /// <summary>
        /// 逻辑删除
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "逻辑删除")]
        public bool IsDeleted { get; set; } = false;

        /// <summary>
        /// 创建人，可以为空
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "创建人")]
        public string? CreatedBy { get; set; }

        /// <summary>
        /// 创建时间，默认为当前系统时间
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "创建时间")]
        public DateTime CreatedTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 更新人，可以为空
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "更新人")]
        public string? UpdatedBy { get; set; }

        /// <summary>
        /// 更新时间，默认为当前系统时间
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "更新时间")]
        public DateTime UpdatedTime { get; set; } = DateTime.Now;
        /// <summary>
        /// 角色Id(外键)
        /// </summary>
        //[SugarColumn(IsNullable = true)]
        //public long RoleId { get; set; }

        ///// <summary>
        ///// 角色导航属性
        ///// </summary>
        //[Navigate(NavigateType.OneToOne, nameof(RoleId))]
        //[SugarColumn(IsIgnore = true)] // 告诉SqlSugar这不是数据库字段
        //public RoleModel Role { get; set; }

    }
}
